local xushi = fk.CreateSkill({
    name = "sj6__xushi",
  })
  
  Fk:loadTranslationTable{
    ["sj6__xushi"] = "蓄势",
    [":sj6__xushi"] = "出牌阶段限一次，你可以展示牌堆顶的三张牌，然后你可以使用其中一张牌，若为伤害牌，此牌伤害+X并重置X。（X为你以此法未使用伤害牌的次数）",
  
    ["@sj6__xushi"] = "蓄势",
    
    ["#sj6__xushi"] = "蓄势：你可以展示牌堆顶的三张牌，然后你可以使用其中一张牌",
    ["$sj6__xushi1"] = "蓄力待时，不争首功。",
    ["$sj6__xushi2"] = "洞若观火，运筹帷幄。",
    ["$sj6__xushi3"] = "时机已到，全军出击！",
  
  }

  xushi:addEffect("active", {
    mute = true,
    anim_type = "control",
    prompt = "#sj6__xushi",
    can_use = function(self, player)
      return player:usedSkillTimes(xushi.name, Player.HistoryPhase) < 1
    end,
    card_filter = Util.FalseFunc,
    target_filter = Util.FalseFunc,
    on_use = function(self, room, Effect)
      local player = Effect.from
      player:broadcastSkillInvoke(xushi.name,2)
      room:notifySkillInvoked(player, xushi.name)
      local cards = room:getNCards(3)
      room:moveCardTo(cards, Card.Processing, nil, fk.ReasonJustMove, xushi.name, nil, true, player.id)
      room:delay(#cards * 150)
      local x = room:askToUseRealCard(player,{
        pattern = cards,
        skill_name = xushi.name,
        cancelable = true,
        skip = true,
        --expand_pile = cards,--不通过extra_data无法额外选择牌
        extra_data = { expand_pile = cards},
      })
      if x ~= nil then
        local n = player:getMark("@sj6__xushi")
        if x.card.is_damage_card and n > 0 then
          room:setPlayerMark(player,"@sj6__xushi",0)
          player:broadcastSkillInvoke(xushi.name,3)
          room:notifySkillInvoked(player, xushi.name,"offensive")
          x.additionalDamage = (x.additionalDamage or 0) + n
        end
        room:useCard(x)
      end
      if x == nil or not x.card.is_damage_card then--没用伤害牌
        player:broadcastSkillInvoke(xushi.name,1)
        room:addPlayerMark(player,"@sj6__xushi",1)
      end
  
      cards = table.filter(cards, function(id) return room:getCardArea(id) == Card.Processing end)--还在处理区的牌
      room:moveCardTo(table.reverse(cards), Card.DrawPile, nil, fk.ReasonPut, xushi.name, nil, true, player.id)
      --未使用的牌需要反转之后放回牌堆，不然第一张抽出来的会放到第三张。
      --把还在处理区的牌放回牌堆顶，展示的牌不会在结算后进入弃牌堆而是回到牌堆顶，所以这里不能置入弃牌堆。
    end,
  })

  return xushi